package com.joysuch.wwyt.bp.enums;

/**
 * @Author ZhaoQiuWei
 * @Date 2021/4/27 11:41
 */
public enum BpAccidentAuditStates {

    TO_AUDIT(1, "待审核"),
    AUDIT_SUCESS(2, "审核通过"),
    AUDIT_FAILURE(3, "审核未通过");
//    TO_RECTIFICATE(4, "待整改"),
//    RECTIFICATE_SUCESS(5, "整改完成");
    private Integer state;
    private String stateName;

    private BpAccidentAuditStates(Integer state, String stateName) {
        this.state = state;
        this.stateName = stateName;
    }

    public Integer getState() {
        return state;
    }

    public String getStateName() {
        return stateName;
    }

    public boolean is(Integer state) {
        return this.state.equals(state);
    }

    public static BpAccidentAuditStates findByCode(Integer state) {
        if (state == null) {
            return null;
        }
        for (BpAccidentAuditStates m : BpAccidentAuditStates.values()) {
            if (m.state.equals(state)) {
                return m;
            }
        }
        return null;
    }

    public static String findNameByState(Integer state) {
        BpAccidentAuditStates m = findByCode(state);
        return m == null ? null : m.getStateName();
    }

}
